<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var n=window.prompt("请输入行数");
        document.write("正金字塔<br/>");
        for(var i = 1; i <= n; i++){
            for(var j = 1; j <= n-i; j++){
                document.write("&nbsp;");
            }
            for(var k = 1; k <= 2*i-1; k++){
                document.write("*")
            }
            document.write("<br/>")
        }
    </script>

    <script>
        var a = window.prompt("请输入一个数");  
        for(var b = 1; b <= a; b++) {  
            for(var c = (a - b) * 2; c >= 0; c--) {  
                document.write(" ");         
            }  
            for(var d = 1; d <= b * 2 - 1; d++) {  
                document.write("*" + " ");  
            }  
            document.write("<br/>");  
        }  
    </script>

    <script>
        var a = window.prompt("请输入行数");
        for(var b=1;b<=a;b++){
            for(var c=(a-b)*2;c>=0;c--){
                document.write(" ");
            }
            for(var d=1;d<=b*2-1;d++){
                document.write("*"+" ")
            }
            document.write("<br/>")
        }
    </script>

    <script>
        function aa(){
            for(var n=0;n<=5;n++){
                for(var j=1;j<=5-n;j++){
                    document.write("&nbsp;&nbsp;");
                }
                for(var i=1;i<=2*n-1;i++){
                    document.write("*")
                }
                document.write("<br/>")
            }
        }
        aa();
    </script>

    <script>
        var a = window.prompt("请输入一个数"); 
        for(var b = 1; b <= a; b++) { 
            for(var c = (a - b) * 2; c >= 0; c--) { 
                document.write(" "); 
            } 
            for(var d = 1; d <= b * 2 - 1; d++) {
                document.write("*" + " "); 
            } 
            document.write("<br/>"); 
        }
    </script>
</body>
</html>